package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.sc.nft.enums.ChainStatusEnum;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.DaoCollectionStore;
import com.sc.nft.mapper.DaoCollectionStoreMapper;
import  com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

/**
 * Dao藏品仓库(sc_dao_collection_store)数据DAO
 *
 * @author zxy
 * @since 2023-05-17 15:28:42
 * @description 活动推荐表
 */
@Slf4j
@Repository
public class DaoCollectionStoreDao extends ServiceImpl<DaoCollectionStoreMapper, DaoCollectionStore> {

    public Boolean updateChainInfo(Long id, String contractAddress, ChainStatusEnum chainStatusEnum,  String deployTransactionHash, String transactionHash, Integer tokenId) {
        UpdateWrapper<DaoCollectionStore> wrapper = new UpdateWrapper<>();
        wrapper.eq("id",id);
        wrapper.set("contract_address",contractAddress);
        wrapper.set("status",chainStatusEnum.getCode());
        wrapper.set("contract_address",contractAddress);
        wrapper.set("deploy_transaction_hash",deployTransactionHash);
        wrapper.set("transaction_hash",transactionHash);
        wrapper.set("numbering",tokenId);
        wrapper.set("token_id",tokenId);
        return update(new DaoCollectionStore(),wrapper);
    }
}